function Connect-Azure {
    [CmdletBinding()]
    [OutputType('Parameters')]
    param (
        [Parameter(Mandatory = $true, Position = 0)][Parameters]$Parameters
    )

    $loginJob = Start-Job -ScriptBlock {
        # Attempt every 0.5 seconds to bring focus to the Azure login window. Will try 6 times.
        for ($i = 0; $i -lt 6; $i++) {
            Start-Sleep -Milliseconds 500
            $wshell = New-Object -ComObject wscript.shell
            if ($wshell.AppActivate('Sign in to your account')) {
                break;
            }
        }
    }

    # Open login window.
    Write-Host # Newline.
    Write-Host "Please log in when prompted. (Login window usually opens in the background.)"; 
    Connect-AzAccount -SubscriptionId $Parameters.Azure.SubscriptionId | out-null
}